package br.org.etec.dotcao.dao.jpa;

import java.util.Collections;
import java.util.List;

import javax.persistence.TypedQuery;

import br.org.etec.dotcao.dao.CityDao;
import br.org.etec.dotcao.model.City;

public class CityDaoImpl extends JPAImpl<City> implements CityDao{
	
	public CityDaoImpl() {
		super(City.class);
	}
	
	@Override
	public List<City> all(long name) {
		TypedQuery<City> query = em.createNamedQuery("selectwithstate", City.class);
		query.setParameter("selectcity", name);
		
		try {
			return query.getResultList();
		} catch (Exception e) {
			e.printStackTrace();
			return Collections.emptyList();
		} 
		
	}

}
